package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming;

/**
 * 描述：lambda形式使用
 */
interface Description {
    String brief();
}

interface Body {
    String detailed(String head);
}

interface Multi {
    String twoArg(String head, Double d);
}

public class LambdaExpressions {
    static Body bod = h -> h + "No Parent";

    static Body bod2 = (h) -> h + "more details";

    static Description description = () -> "short info";

    static Multi multi = (h, n) -> h + n;

    static Description moreLines = () -> {
        System.out.println("moreLines()");
        return "from moreLines()";
    };

    public static void main(String[] args) {
        System.out.println(bod.detailed("OH!"));
        System.out.println(bod2.detailed("HI!"));
        System.out.println(description.brief());
        System.out.println(multi.twoArg("PI！", 3.1415926));
        System.out.println(moreLines.brief());
    }
}
